from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LinearRegression
import pandas as pd
import pickle


data_path = r'creditcard.csv'
df = pd.read_csv(data_path)
X = df.iloc[:, 1:-2]
Y = df.iloc[:, -1]
print(X.shape)
print(Y.shape)

knn = KNeighborsClassifier(n_neighbors=5).fit(X, Y)
# knn.predict_proba(X)

lr = LinearRegression().fit(X, Y)
# lr.pred_proba(X)

with open('model-knn.pkl', 'bw') as f:
    pickle.dump(knn, f)

with open('model-lr.pkl', 'bw') as f:
    pickle.dump(lr, f)
